import { MigrationInterface, QueryRunner } from 'typeorm';

/**
 * 为 match_import_configs 表添加 failureReason 字段
 */
export class AddFailureReasonToMatchImportConfig1734568000000 implements MigrationInterface {
  name = 'AddFailureReasonToMatchImportConfig1734568000000';

  public async up(queryRunner: QueryRunner): Promise<void> {
    // 添加 failureReason 字段
    await queryRunner.query(`
      ALTER TABLE \`match_import_configs\` 
      ADD \`failureReason\` text NULL 
      COMMENT '最近一次导入失败的详细原因'
    `);
  }

  public async down(queryRunner: QueryRunner): Promise<void> {
    // 删除 failureReason 字段
    await queryRunner.query(`
      ALTER TABLE \`match_import_configs\` 
      DROP COLUMN \`failureReason\`
    `);
  }
}